const test = ["1b", "2b", "13c", "5b", "6a", "2a", "4b"];

let map = new Map();

for (let i = 0; i < test.length; i++) {
  let k = test[i][test[i].length - 1];
  if (map.get(k)) {
    map.set(k, map.get(k) + 1);
  } else {
    map.set(k, 1);
  }
}
console.log(map);

let max =test[0][test[0].length-1]

for(let key of map.keys()){
  if(map.get(key)>map.get(max)){
    max=key
  }
}
let sum=0

test.forEach((v)=>{
  sum+=Number.parseInt(v.slice(0,v.length-1))
})

console.log(Number.parseInt(test[0].slice(0,test[0].length-1)))
console.log(sum)